﻿using AgileConfig.Client;
using Quartz;
using System.Threading.Tasks;

namespace ProxyServer.Constants;

public static class ServiceCollectionExtensions
{
    public static IConfigurationBuilder AddAgileConfig(this IConfigurationBuilder builder, ConfigurationManager configuration)
    {
        var agileConfig = configuration.GetSection("AgileConfig");
        if (agileConfig?.Exists() ?? false)
        {
            builder.AddAgileConfig((ConfigClientOptions options) => agileConfig.Bind(options));
        }

        return builder;
    }
}
